<?php

namespace sframe;

use Symfony\Component\Routing\Route as SymfonyRoute;

class Route extends SymfonyRoute
{
	/**
	 * Constructor.
	 *
	 * Available options:
	 *
	 * @param string          $path         The path pattern to match
	 * @param array           $defaults     An array of default parameter values
	 * @param array           $requirements An array of requirements for parameters (regexes)
	 * @param array           $options      An array of options
	 * @param string          $host         The host pattern to match
	 * @param string|string[] $schemes      A required URI scheme or an array of restricted schemes
	 * @param string|string[] $methods      A required HTTP method or an array of restricted methods
	 * @param string          $condition    A condition that should evaluate to true for the route to match
	 */
	public function __construct(string $path, array $defaults = [], array $requirements = [], array $options = [], ?string $host = '', $schemes = [], $methods = [], ?string $condition = '')
	{
		if (isset($defaults["_controller"])) {
			if (strpos($defaults["_controller"], "\\") !== 0) {
				$controllerPrefix = "\app\controllers\\";
				$defaults["_controller"] = $controllerPrefix . $defaults["_controller"];
			}
		}
		parent::__construct($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
	}
}
